fix(pipeline): merge_to_main pushed HEAD, not the task's branch - #280
Merged
Conversation
It ran `git push origin HEAD:refs/heads/main` from `resolve_working_dir`. That is the task's worktree when it has one — and the **shared workspace checkout** when it doesn't, which happens routinely: terminal-column cleanup removes the worktree while `branch_name` survives on the row. So `HEAD` was whatever the user happened to have checked out. With the repo sitting on `main`, `HEAD:refs/heads/main` is a no-op push that *succeeds* — the trigger then logged "Pushed <branch> to origin/main" having merged nothing at all. On any other branch it would have published unrelated working state to main. Both failure modes are silent. The success log made the first one actively misleading. Now pushes the task's branch by name — the same branch the function validates at the top and names in that log line. Extracted as `merge_to_main_refspec` so a test pins the one thing that must not regress. Verified against a real bare origin: before the fix, origin/main stayed at the initial commit and the branch's file never appeared on it despite the success log; after, origin/main advanced and carries it. `execute_auto_merge` was checked for the same pattern and does not share it — it passes the branch name through explicitly. Worth noting separately: `merge_to_main` is backend-only. It is absent from the frontend `ActionType` union, so no UI can configure a column to use it.
… auto_setup/create_pr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The worst one this session, because it reported success while doing nothing.
The bug
…run from
resolve_working_dir. That is the task's worktree when it has one, and the shared workspace checkout when it doesn't — which happens routinely, since terminal-column cleanup removes the worktree whilebranch_namesurvives on the row.So
HEADwas whatever the user happened to have checked out:main→HEAD:refs/heads/mainis a no-op push that succeeds. The trigger then logsPushed <branch> to origin/mainhaving merged nothing.Both are silent. The success log made the first actively misleading — I only caught it because I checked
git ls-remoterather than trusting the log.Reproduction, against a real bare origin
Before:
After:
The fix
Push the task's branch by name — the same branch the function validates at the top and names in that log line. Extracted as
merge_to_main_refspecso a test pins the one thing that must not regress (that it never namesHEAD).execute_auto_mergewas checked for the same pattern and does not share it — it passes the branch name through explicitly.Worth flagging separately
merge_to_mainis backend-only: it's absent from the frontendActionTypeunion, so no UI can configure a column to use it. Noted on the roadmap rather than fixed here — that's a feature decision, not a bug fix.Checks
cargo clippy -D warnings·cargo test --lib569 (+1) ·tsc·eslint·vitest444.